package file;

import java.io.File;
import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入：");
        String key = scan.nextLine();
        File dir = new File("./src/main/java/file");
        if(dir.isDirectory()){
            File[] file = dir.listFiles();
            for (int i = 0; i < file.length; i++) {
                String fileName = file[i].getName();
                if(fileName.contains(key)){
                    System.out.println(fileName);
                }
            }
        }
    }
}
